import type { BasePageReq } from '@wlydfe/service'
import type { TaskModel } from './type'
import http from '@/service'
/**
 * 查询代办列表
 *
 * @param params 搜索参数
 */
export const getQueryPage = (params: BasePageReq<Partial<TaskModel>>) => {
  return http.post(
    {
      url: '/creditworkflow/approval/process/queryPage',
      data: params,
    },
    { urlGateway: '/gateway' },
  )
}

/**
 * 查询详情
 * @param params 
 * @returns 
 */
export const queryDetail = (params) => {
  return http.post({
    url: '/creditworkflow/approval/process/queryDetail',
    data: params
  }, { urlGateway: '/gateway' })
}

/**
 * 驳回 、 通过
 * @param {*} params
 * @param {*}
 * @returns
 */
export function submitTask(params) {
  return http.post({
    url: '/creditworkflow/approval/process/completeTask',
    data: params
  }, { urlGateway: '/gateway' })
}

/**
 * 获取任务表单-自定义列表
 * @param {*} params
 * @param {*}
 * @returns
 */
export function queryTaskForm(params) {
  return http.post({
    url: '/creditworkflow/approval/process/queryTaskForm',
    data: params
  }, { urlGateway: '/gateway' })
}

/**
 * 获取流程图节点信息--操作记录
 * @param {*} params
 * @param {*}
 * @returns
 */
export function queryAuditTaskList(params) {
  return http.post({
    url: '/creditworkflow/approval/process/queryAuditTaskList',
    data: params
  }, { urlGateway: '/gateway' })
}

/**
 * 获取流程图
 * @param {*} params
 * @param {*}
 * @returns
 */
export function queryRunningFlowChart(params) {
  return http.post({
    url: '/creditworkflow/approval/process/queryRunningFlowChart',
    data: params
  }, { urlGateway: '/gateway' })
}

/**
 * 下载附件
 * get请求,query传参
 * @param {*} url
 * @returns
 */
export function downloadAttachment(url) {
  return http.get({
    url: '/creditworkflow/file/download',
    params: {
      path: url
    }
  }, { urlGateway: '/gateway' })
}
